import { Controller, Inject, Get, Param, Post, Body, Put, Delete } from '@nestjs/common';
import { ArticeService } from './artice.service';
import { ApiTags } from '@nestjs/swagger';
import { ArticeDto } from 'src/dto/artice.dto';

@ApiTags('Artice')
@Controller('artice')
export class ArticeController {
    constructor(@Inject(ArticeService) private readonly articeService: ArticeService) { }

    @Get()
    async findAll() {
        return await this.articeService.findAll()
    }

    @Get(':id')
    async findOne(@Param('_id') id:string) {
        return await this.articeService.findOne(id)
    }

    @Post()
    async create(@Body() body:ArticeDto) {
        return await this.articeService.create(body)
    }

    @Put()
    async update(@Param('_id') id:string, @Body() body:ArticeDto) {
        return await this.articeService.put(id, body)
    }

    @Delete(':id')
    async delete(@Param('_id') id:string) {
        return await this.articeService.deleteOne(id)
    }
}
